package org.dromara.web.domain.bo;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.github.linpeilie.annotations.AutoMapper;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.web.domain.Market;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serial;
import java.math.BigDecimal;
import java.util.Date;

@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = Market.class, reverseConvertGenerate = false)
public class MarketBo extends BaseEntity {

    @Serial
    private static final long serialVersionUID = 1L;

    @NotNull(message = "ID不能为空", groups = {EditGroup.class})
    private Long id;
    private String cname;
    private String category;
    private String symbol;
    private BigDecimal price;
    private BigDecimal diff;
    private BigDecimal chg;
    private BigDecimal preclose;
    private BigDecimal open;
    private BigDecimal high;
    private BigDecimal low;
    private BigDecimal amplitude;
    private Long volume;
    private BigDecimal mktcap;
    private String market;

    // 新增排序参数
    private String sortField; // 排序字段（如：time）
    private String sortOrder; // 排序方式（asc/desc）


    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date time;
}
